package com.gebogebo.mobile.parking;

import java.util.ArrayList;
import java.util.List;

import android.graphics.drawable.Drawable;

import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.OverlayItem;

public class ParkingSpotOverlay extends ItemizedOverlay<OverlayItem> {
private List<OverlayItem> overlayItems = new ArrayList<OverlayItem>();
    
    public ParkingSpotOverlay(Drawable defaultMarker) {
        //makes center-bottom point of an image as point of consideration
        super(boundCenterBottom(defaultMarker));
    }

    @Override
    protected OverlayItem createItem(int num) {
        return overlayItems.get(num);
    }

    @Override
    public int size() {
        return overlayItems.size();
    }
    
    /**
     * adds overlay item to the list of items in this overlay 
     * 
     * @param item overlay item to be added
     */
    public void addOverlay(OverlayItem item) {
        overlayItems.add(item);
        populate();
    }
}
